import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BiTest {

    //n个点,
    //找个所有四个点的组合
    //使得上文这四个点能组成一个长方形, 且这个长方形与xy轴平行
    class Node{
       public int x;
       public int y;

        public Node(int x, int y){
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }
    }

    static class Rectangle{
        List<Node> nodes;
        public Rectangle(){

        }
        public void setNodes(List<Node> nodes){
            this.nodes = nodes;
        }
    }

    public static void main(String args[]) {
        List<Node> nodeRaw = new ArrayList<>();
        List<Rectangle> ans = new ArrayList<>();

        for (Node a:nodeRaw) {
            Map<Integer, Node> axOK = new HashMap<>();
            Map<Integer, Node> ayOK = new HashMap<>();

            for (Node temp:nodeRaw) {
                if(temp.x == a.x&&temp.y!= a.y){
                    axOK.put(temp.y,temp);
                }
                if(temp.x !=a.x&&temp.y == a.y){
                    ayOK.put(temp.x,temp);
                }
            }
            for (Node tryNode: nodeRaw) {
                if(null!= axOK.get(tryNode.y)&&null!= ayOK.get(tryNode.x)){
                    List<Node> nodes = new ArrayList<>();
                    nodes.add(tryNode);
                    nodes.add(a);
                    nodes.add(axOK.get(tryNode.y));
                    nodes.add(ayOK.get(tryNode.x));
                    Rectangle rec = new Rectangle();
                    rec.setNodes(nodes);
                    ans.add(rec);
                }
            }

        }


        //single Node a
        //for  raw[i].x = a.x ;  raw[j].y = a.y
        //List<Node> axOK; List<Node> ayOK;
        //nodeRaw.stream->  axOK.y = node.y && ayOK.x = node.x;



    }

}
